package consultan.vanke.com.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;

import androidx.constraintlayout.widget.ConstraintLayout;

import butterknife.BindView;
import butterknife.OnClick;
import consultan.vanke.com.R;
import consultan.vanke.com.utils.SimpleToolbar;

import static com.bytedance.sdk.account.open.aweme.utils.ViewUtils.getStatusBarHeight;
import static consultan.vanke.com.utils.StatusBarUtil.setRootView;


public class DsYkFragment extends BaseFragment {
    @BindView(R.id.img_top)
    ImageView imgTop;
    @BindView(R.id.img_center)
    ImageView imgCenter;
    @BindView(R.id.img_bottom)
    ImageView imgBottom;
    @BindView(R.id.img_left)
    ImageView imgLeft;
    @BindView(R.id.img_right)
    ImageView imgRight;
    private View inflate;
    private boolean isfristshow = true;
    @BindView(R.id.simple_toolbar)
    SimpleToolbar simpleToolbar;
    @BindView(R.id.simple_toolbar_main)
    ConstraintLayout simpleToolbarMain;

    @Override
    protected void initViews() {
        simpleToolbar.setMainBg(getResources().getColor(R.color.color_333333));
        simpleToolbar.setMainTitle("电视遥控器");
        simpleToolbar.setMainTitleColor(getResources().getColor(R.color.white_color));
        simpleToolbar.setRightTitleDrawable(R.mipmap.setting);
        simpleToolbar.setLeftTitleDrawableSingle(R.mipmap.back_white);
    }

    @Override
    protected void initDatas() {
    }

    @Override
    protected void initEvents() {
        simpleToolbar.setLeftTitleClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                pop();
            }
        });
        simpleToolbar.setRightTitleAginClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                start(new DsYkFragment());
            }
        });
    }

    @Override
    protected View initContentView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        inflate = View.inflate(_mActivity, R.layout.dsyk_fragment, null);
        return inflate;
    }

    @Override
    public void onSupportVisible() {
        super.onSupportVisible();
        ViewGroup decorView = (ViewGroup) _mActivity.getWindow().getDecorView();
        View fakeStatusBarView = new View(_mActivity);
        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, getStatusBarHeight(_mActivity) + 3);
        fakeStatusBarView.setLayoutParams(params);
        fakeStatusBarView.setBackground(getResources().getDrawable(R.drawable.bg_333));
        fakeStatusBarView.setId(android.R.id.custom);
        decorView.addView(fakeStatusBarView);
        setRootView(_mActivity, false);
//        if (isfristshow) {
//            setPaddingTop(_mActivity, simpleToolbar);
//            isfristshow = false;
//        }
        setStatusBarColors(R.color.color_333333, true);
    }

}
